/*
 * @Author: 刘润泽
 * @Date: 2023-03-14 17:52:41
 * @LastEditors: 刘润泽
 * @LastEditTime: 2023-03-14 19:12:08
 * @Description: 
 */
package server.business.converter.Converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

public class BloodCompositionConverter implements Converter<String> {
    @Override
    public Class<String> supportJavaTypeKey() {
        return String.class;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    @Override
    public CellData<String> convertToExcelData(String value, ExcelContentProperty excelContentProperty,
            GlobalConfiguration globalConfiguration) throws Exception {
        if (value == null) {
            return new CellData<>("");
        } else if (value.equals("11")) {
            return new CellData<>("全血");
        } else if (value.equals("12")) {
            return new CellData<>("去白细胞全血");
        } else if (value.equals("21")) {
            return new CellData<>("浓缩红细胞");
        } else if (value.equals("22")) {
            return new CellData<>("去白细胞浓缩红细胞");
        } else if (value.equals("23")) {
            return new CellData<>("悬浮红细胞");
        } else if (value.equals("24")) {
            return new CellData<>("去白细胞悬浮红细胞");
        } else if (value.equals("25")) {
            return new CellData<>("洗涤红细胞");
        } else if (value.equals("26")) {
            return new CellData<>("冰冻红细胞");
        } else if (value.equals("27")) {
            return new CellData<>("冰冻解冻去甘油红细胞");
        } else if (value.equals("31")) {
            return new CellData<>("单采粒细胞");
        } else if (value.equals("42")) {
            return new CellData<>("混合浓缩血小板");
        } else if (value.equals("43")) {
            return new CellData<>("单采血小板");
        } else if (value.equals("44")) {
            return new CellData<>("去白细胞单采血小板");
        } else if (value.equals("51")) {
            return new CellData<>("新鲜冰血浆");
        } else if (value.equals("52")) {
            return new CellData<>("病毒灭活新鲜冰冻血浆");
        } else if (value.equals("53")) {
            return new CellData<>("冰冻血浆");
        } else if (value.equals("54")) {
            return new CellData<>("病毒灭活冰冻血浆");
        } else if (value.equals("55")) {
            return new CellData<>("单采新鲜冰冻血浆");
        } else if (value.equals("61")) {
            return new CellData<>("冷沉淀凝血因子");
        } else if (value.equals("99")) {
            return new CellData<>("其他");
        } else {
            return new CellData<>("错误数据");
        }
    }

    @Override
    public String convertToJavaData(CellData arg0, ExcelContentProperty arg1, GlobalConfiguration arg2)
            throws Exception {
        throw new UnsupportedOperationException("Unimplemented method 'convertToJavaData'");
    }
}
